package com.vincent.sciinfo.handler;


import com.vincent.sciinfo.exception.TokenExpiredException;
import com.vincent.sciinfo.pojo.TSMResult;
import com.vincent.sciinfo.utils.StatusCode;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

@ControllerAdvice
public class TokenExpiredExceptionHandler {

    @ExceptionHandler(TokenExpiredException.class)
    @ResponseBody
    public TSMResult TokenExpiredExceptionHandle(TokenExpiredException e) {
        return new TSMResult(StatusCode.TOKEN_EXPIRED, e.getMessage(), null);
    }
}

